package cn.swpu.blog.service.impl;

import cn.swpu.blog.dao.UserInfoMapper;
import cn.swpu.blog.entity.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

/**
 * @Author 冰翔
 * @Date 2021/2/19 11:28
 */
@Component
public class MyUserDetailsImpl implements UserDetailsService {

    @Autowired
    UserInfoMapper userInfoMapper;

    @Override
    public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
        UserInfo userInfo = userInfoMapper.selectByPrimaryKey(s);
        return userInfo;
    }
}
